<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
            background-color: lightblue;
            color: aliceblue;
        }

        .container {
            display: flex;
        }

        .container aside {
            width: 200px;
            background-color: lightblue;
            color: aliceblue;
            text-align: center;
            line-height: 40px;
            display: flex;
            flex-direction: column;
            justify-content: space-around;
        }

        main {
            flex: 1;
            padding: 20px;
        }

        .active {
            background-color: #555;
            color: #eee;
        }

        .inputbox {
            margin: 20px 0;
        }

        input {
            height: 40px;
            border-radius: 20px;
            width: 300px;
            padding-left: 20px;
            outline: none;

        }

        button {
            background-color: lawngreen;
            border-radius: 5px;
            text-align: center;
            line-height: 40px;
            color: white;
            margin-left: 20px;
            padding: 0 30px;
            border: none;
        }

        .add {
            background-color: lawngreen;
            border-radius: 5px;
            text-align: center;
            line-height: 40px;
            color: white;
            margin-left: 20px;
            padding: 0 30px;
            border: none;
        }

        table {
            margin: 20px 0;
            width: 100%;
            line-height: 40px;
            text-align: center;
        }

        table tr th {
            max-width: 200px;
        }

        .container main table tr th:first-child,
        .container main table tr td:first-child {
            text-align: left;
        }

        .foot {
            text-align: center;
            line-height: 40px;
        }

        .foot span {
            border: 1px solid #ccc;
            padding: 0 30px;
            display: inline-block;
        }
    </style>
</head>

<body>
    <header>
        <span class="loge">9466云专题</span>
        <span>龙猫（9466云专题）</span>
    </header>
    <section class="container">
        <aside>
            <div>首页</div>
            <div>专题</div>
            <div>用户</div>
            <div>设置</div>
            <div>日志</div>
        </aside>
        <main>
            <div class="inputbox">
                <input type="text" placeholder="搜索用户">
                <button>搜索</button>
            </div>
            <button class="add">+添加用户</button>
            <table>
                <thead>
                    <tr>
                        <th>邮箱（用户）</th>
                        <th>姓名</th>
                        <th>电话</th>
                        <th>所属组</th>
                        <th>管理员</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <!--  <tr>
                        <td>121211212@qq.com</td>
                        <td>李佳琪</td>
                        <td>15291695373</td>
                        <td>编辑组</td>
                        <td>是</td>
                        <td><span class="statusok">正常</span></td>
                        <td><span>编辑</span><span>删除</span></td>
                    </tr>
                    <tr>
                        <td>121211212@qq.com</td>
                        <td>李佳琪</td>
                        <td>15291695373</td>
                        <td>编辑组</td>
                        <td>是</td>
                        <td><span class="statusok">正常</span></td>
                        <td><span>编辑</span><span>删除</span></td>
                    </tr> -->
                </tbody>
            </table>
            <div class="foot">
                <span>上一页</span>
                <span>下一页</span>
            </div>
        </main>
    </section>
</body>

</html>
<script src="https://cdn.bootcdn.net/ajax/libs/Mock.js/1.0.0/mock.js"></script>
<script src="./promise-ajax.js"></script>
<script src="./mockdata.js"></script>
<script>
    // ajax('get', './tabledata.json', {}).then((res) => {
    //     render(res)
    // })
    render(data.list)
    function render(data) {
        var str = data.map((item, index) => {
            return `<tr>
                        <td>${item.email}</td>
                        <td>${item.name}</td>
                        <td>${item.phone}</td>
                        <td>${item.ingroup}</td>
                        <td>${item.isadmin ? '是' : '否'}</td>
                        <td><span class="statusok">${item.statues ? '正常' : '不正常'}</span></td>
                        <td><span>编辑</span><span>删除</span></td>
                    </tr>`
        }).join('')
        document.querySelector('tbody').innerHTML = str
    }

</script>